﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Host.Models;


namespace Host.Controllers
{
    public class HomeController : BaseController
    {
        public const int PageSize = 10;

        


        [Authorize(Roles = "Administrator, Developer")]
        public ActionResult Index()
        {
            
            ViewBag.Message = "Welcome to ASP.NET MVC!";
            
            
            return View();
        }

        [Authorize(Roles = "Administrator, Developer")]
        public ActionResult About()
        {

            return View();
        }

        //[GridAction]
        //public ActionResult _AjaxBinding()
        //{
        //    var list = new Models.Data().FundAnswerSheet.Where(i => i.FundId == 42).Select(x => new MapQuestionAndAnswer
        //    {
        //        FundAnswerSheetId = x.FundAnswerSheetId,
        //        Answer = x.AnswerValue,
        //        QuestionId = x.QuestionId
        //    });

        //    List<MapQuestionAndAnswer> newList = new List<MapQuestionAndAnswer>();
        //    using (Data db = new Data())
        //    {
        //        foreach (var mapQuestionAndAnswer in list)
        //        {
        //            Models.Question q = db.Question.Where(i => i.QuestionId == mapQuestionAndAnswer.QuestionId).Select(x => x).Single();
        //            if (q.QuestionGroupId == 13)
        //            {
        //                mapQuestionAndAnswer.Description = q.Question1;
        //                AnswerDataType a =
        //                    db.AnswerDataType.Where(i => i.AnswerDataTypeId == q.AnswerDataTypeId).Select(x => x).Single();
        //                mapQuestionAndAnswer.AnswerType = a.AnswerDataTypeDescription;
        //                newList.Add(mapQuestionAndAnswer);
        //            }
        //        }
        //    }
        //    return View(new GridModel(newList));

        //}

        //public ActionResult GroupingAjax()
        //{
        //    var list = new Models.Data().FundAnswerSheet.Where(i => i.FundId == 42).Select(x => new MapQuestionAndAnswer
        //    {
        //        FundAnswerSheetId = x.FundAnswerSheetId,
        //        Answer = x.AnswerValue,
        //        QuestionId = x.QuestionId
        //    });

        //    List<MapQuestionAndAnswer> newList = new List<MapQuestionAndAnswer>();
        //    using (Data db = new Data())
        //    {
        //        foreach (var mapQuestionAndAnswer in list)
        //        {
        //            Models.Question q = db.Question.Where(i => i.QuestionId == mapQuestionAndAnswer.QuestionId).Select(x => x).Single();
        //            if (q.QuestionGroupId == 13)
        //            {
        //                mapQuestionAndAnswer.Description = q.Question1;
        //                AnswerDataType a =
        //                    db.AnswerDataType.Where(i => i.AnswerDataTypeId == q.AnswerDataTypeId).Select(x => x).Single();
        //                mapQuestionAndAnswer.AnswerType = a.AnswerDataTypeDescription;
        //                newList.Add(mapQuestionAndAnswer);
        //            }
        //        }
        //    }
        //    return View(newList);
        //}

    }

    
}
